Skip to content

783 - Dining Hall Header Fixes - #789

Merged
TheAbubakrAbu merged 4 commits into
devfrom
783/dining-hall-header-bug
Nov 16, 2026
Merged

TheAbubakrAbu merged 4 commits into
devfrom
783/dining-hall-header-bug

Conversation

@samikabhatkar-web

@samikabhatkar-web samikabhatkar-web commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addressed the four fixes to the dining hall pages and settings sidebar.

  • The main implementation was the "Show Suitable Dishes Only" setting. This replaces the old "Show Preferences Only" header button and is saved on the user's account, so it persists across reloads and devices. (Required a small backend change)

Changes

  • 1. Open/Closed status next to the hall name (no change needed). Already working on dev branch, so there wasn't anything to address here
  • 2. Weekday in the date picker. Added format="MM/dd/yyyy (EEE)" to the MUI DatePicker in restaurant-filters.tsx (line 154), so it shows 10/27/2026 (Tue).
  • 3. "Show Suitable Dishes Only" switch in the settings sidebar, saved to the user's account.
  • 4. View toggles moved into the header row. The card/compact buttons are now the right-most controls in the filters row, after the date picker

3rd fix in detail

Frontend

  • New MUI Switch labelled "Show Suitable Dishes Only", under Allergies in the signed-in "Dietary Preferences" section.
  • hooks/useShowSuitableDishesOnly.ts (new): reads the setting from the existing user.get query and writes it with the new mutation.
  • restaurant/dishes-view.tsx reads this hook instead of the old in-memory showPreferencesOnly flag.
  • Removed the "Show Preferences Only" button and other unnecessary imports in restaurant-filters.tsx

Backend

  • Database: packages/db/src/schema/users.ts adds showSuitableDishesOnly: boolean(...).default(false).notNull() to the users table, the same pattern as hasOnboarded. Existing users get false.
  • Migration: packages/db/migrations/0013_peterplate.sql, plus meta/0013_snapshot.json and the _journal.json entry, generated with drizzle-kit generate. The SQL is a single statement:
    ALTER TABLE "users" ADD COLUMN "showSuitableDishesOnly" boolean DEFAULT false NOT NULL;
  • API: packages/api/src/users/router.ts adds the mutation user.setShowSuitableDishesOnly (
    • Input: { id: string, value: boolean }.
    • Runs UPDATE users SET showSuitableDishesOnly = value, updatedAt = now() WHERE id = id, in the same style as the existing onboard mutation.
    • Returns NOT_FOUND if no user matches, and INTERNAL_SERVER_ERROR if the update fails.
  • Reading the setting: no new query. The existing user.get returns the full user row, so the new column comes back automatically. Like the other user procedures, the mutation trusts the id sent by the client and doesn't check it

Testing Instructions

This branch needs a database migration. The schema now includes a new column, and Better Auth queries every column on users, so if you haven't migrated, login and the session will fail.

  1. Pull the branch and install dependencies as usual.
  2. Apply the migration with pnpm db:migrate

Closes #783

@samikabhatkar-web
samikabhatkar-web temporarily deployed to staging-789 November 5, 2026 20:12 — with GitHub Actions Inactive
@github-actions
github-actions Bot temporarily deployed to staging-789 November 5, 2026 20:13 Inactive
@TheAbubakrAbu
TheAbubakrAbu temporarily deployed to staging-789 November 16, 2026 09:06 — with GitHub Actions Inactive
@github-actions
github-actions Bot temporarily deployed to staging-789 November 16, 2026 09:06 Inactive
@TheAbubakrAbu
TheAbubakrAbu merged commit 0741ef8 into dev Nov 16, 2026
2 checks passed
@TheAbubakrAbu
TheAbubakrAbu deleted the 783/dining-hall-header-bug branch November 16, 2026 09:27

This branch was successfully deployed

1 active deployment
staging-789 — 8639d80c Deployed Nov 16, 2026 by TheAbubakrAbu via destroy #107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants